package com.freecloud.tomcat.bio.http;

import java.io.OutputStream;

/**
 * @Author: maomao
 * @Date: 2021/8/30 10:04 上午
 */
public class FreeResponse {

    private OutputStream outputStream;

    public FreeResponse(OutputStream os) {
        this.outputStream = os;
    }

    public void write(String s) throws Exception {
        StringBuilder sb = new StringBuilder();
        sb.append("HTTP/1.1 200 ok\n").append("Content-Type: text/html;charset=utf-8\n").append("\r\n").append(s);

        outputStream.write(sb.toString().getBytes());
    }
}
